package com.linkai.onlinetool.controller;

import com.alibaba.fastjson.JSON;
import com.linkai.onlinetool.entity.ImageCode;
import com.linkai.onlinetool.util.VerifyCodeUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


// 生成一张 “图形验证码”，返回该图形验证码的url和对应的验证码内容
@RestController
public class VerifyCodeController {

    // 添加跨域的处理
    @GetMapping("/imagecode")
//    @CrossOrigin(value = "http://101.132.147.111:8080", maxAge = 1800, allowedHeaders = "*")
    @CrossOrigin(allowCredentials="true",maxAge = 3600)
    public String vcImage() {
        String resultJSON = VerifyCodeUtils.createOneCodeImage();
        return resultJSON;
    }

}
